#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>

#define LOG "log.txt"

int main()
{
    umask(0);
    //int fd = open(LOG, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    //int fd = open(LOG, O_WRONLY | O_CREAT | O_APPEND, 0666);
    int fd = open(LOG, O_RDONLY);

    const char* msg = "In a sentimental mood\n";
    
    
   // write(fd,msg,strlen(msg)); 
   // write(fd,msg,strlen(msg)); 
   // write(fd,msg,strlen(msg));
   // write(fd,msg,strlen(msg));
   // write(fd,msg,strlen(msg));
   // write(fd,msg,strlen(msg));
    
    char buf[1024] = {0};
    read(fd,buf,sizeof(buf)-1);

    printf("%s",buf);

    close(fd);
    return 0;
}
